package cn.csust.net2.manager.server.service.impl;

import org.springframework.stereotype.Service;

import cn.csust.net2.manager.shared.exception.BeyondAuthorityException;
import cn.csust.net2.manager.shared.po.User;
import cn.csust.net2.manager.shared.service.SecurityService;
import cn.csust.net2.manager.shared.util.ServiceConstant;

/** 
 * @author 韩忠金
 * @version 创建时间：2012-1-26 上午10:42:30 
 * 类说明 
 */
@Service(value = ServiceConstant.SERVICE_NAME_SECURITY)
public class SecurityServiceImpl extends BaseServiceImpl implements SecurityService{
	
	@Override
	public boolean testSecurity(User user,String authority)throws BeyondAuthorityException {
	//	User user = (User) this.request.getSession().getAttribute(USER_SYS);
		if(user==null)
			return false;
		System.out.println("加载到用户名为"+user.getUserID()+"加载到的模块为"+authority);
		int count = this.getSqlMapper().judgeAuthority(user.getUserID(), authority);
		System.out.println("查询到"+count);
		if(count>0)
			return true;
		else
			return false;

	}

}
